<?PHP
include("../config/connect.php");
include("../public/common.php");

$tbid = GetPostParamStr("tbid");
if( $tbid != "" )
{
	$sql = "select id,type from user where tb_id='$tbid' limit 1";
	$result = mysql_query( $sql );
	if (mysql_num_rows($result) == 0)
	{
		echo "<script>alert(\"输入账号无效，请确保已经在购物兔中绑定过的账号！\"); </script>";
	}
	else
	{
		$row = mysql_fetch_assoc( $result );
		$id = $row["id"];
		$type = $row["type"];
		if ($row["type"] != 'N')
		{
			echo "<script>alert(\"您已经是联盟用户，无需重复申请！\\r\\n进入购物兔的个人中心，即可看到详细的推广信息。\"); </script>";
		}
		else
		{
			$type = 'N';
			mysql_query("update user set type='U',type_time=now() where id=$id");
			echo "<script>alert(\"恭喜，申请成功！把您的邀请链接发给好友，或直接告诉他们您的邀请码即可。\\r\\n进入购物兔的个人中心，可以看到详细的推广信息。\");</script>";
		}
		
		$_SESSION["code"]=MakeRecommendCodeFrom($id, $type);
	}
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name ="keywords" content="购物兔用户联盟,用户联盟,购物专用浏览器,网购专用浏览器,购物返利,网购返利,网购省钱,网购安全,安全购物,打折,折扣,省钱达人,购物达人"/>
<meta name="Description" content="购物兔用户联盟,用户联盟,购物专用浏览器,网购专用浏览器,购物返利,网购返利,网购省钱,网购安全,安全购物,打折,折扣,省钱达人,购物达人" />
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<title>购物兔用户联盟</title>

<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #000;
	font-family: 宋体;
}
body {
	background-color: #FFF;
}

-->
</style>

<script language="javascript" src="../js/common.js"></script>
<script language="javascript">
function OnJion()
{
	if (!document.getElementById("agree_id").checked)
	{
		alert( "您必须同意“购物兔用户联盟协议”，才能申请加入。" );
		document.getElementById("agree_id").focus();
		return;
	}
	
	var tbid = document.getElementById("tbid_id").value;
	if( tbid == "" )
	{
		alert( "请输入您的支付宝帐号。" );
		document.getElementById("tbid_id").focus();
		return;
	}
	else
	{
		if( (!isemail( tbid )) && (!isphone( tbid )) )
		{
			alert( "您输入的支付宝帐号格式不对哦，请确认是支付宝账号，您可能输入的是淘宝账号。" );
			document.getElementById("tbid_id").focus();
			return;
		}
	}
	
	document.getElementById("jion_id").submit();
}
</script>

</head>

<body style="margin-top:0px;">
<table width="880" border="0" align="center" cellspacing="0" cellpadding="0">
<tr background="images/bar_bg.png">
	<td width="350" height="92" align="center" background="images/bar_bg.png"><img src="images/logo.gif" width="179" height="80" /></td>
    <td width="110" height="90" valign="bottom" background="images/bar_bg.png"><img src="images/btnhomepage_h.gif" /></td>
    <td width="110" height="90" valign="bottom" background="images/bar_bg.png"><a href="index_xieyi.html"><img border="0" src="images/btnxieyi.gif" width="62" height="24" /></td>
    <td width="110" height="90" valign="bottom" background="images/bar_bg.png"><a href="index_shouyi.html"><img border="0" src="images/btnshouyi.gif" /></a></td>
    <td height="90" valign="bottom" background="images/bar_bg.png">&nbsp;</td>
</tr>
</table>

<table width="880" border="0" align="center" cellspacing="0">
<tr><td height="10"></td></tr>
<tr><td><hr width="860" /></td></tr>
</table>

<table width="880" border="0" align="center" cellspacing="0" bgcolor="#F5F7F7" style="border:solid; border-width:1px; border-color:#999999;">
<tr><td><img src="images/g_about.gif" /></td></tr>
<tr><td height="16"></td></tr>
<tr><td style="line-height:1.5;"><div style="width:800px; padding-left:36px">
    &nbsp;&nbsp;&nbsp;&nbsp;购物兔联盟是购物兔（后面简称兔子）为喜欢兔子的用户量身定做的。不论老少，不论性别，无论您是在职还是学生，只要您喜欢兔子，您就可以加入。在您和您的朋友们一起享受兔子带来购物乐趣的同时，也能给您带来一定的收入。<br /> 
    如果您有一定的资源，购物兔联盟还能为您带来不菲的稳定收入！这些资源包括但不限于：
      <br />
       &nbsp;&nbsp;&nbsp;&nbsp;1、您是站长或版主
      <br />
       &nbsp;&nbsp;&nbsp;&nbsp;2、您是学生，在学校比较活跃，如学生会等
      <br />
       &nbsp;&nbsp;&nbsp;&nbsp;3、您在生活中比较活跃，QQ好友、QQ群或者经常上一些论坛
      <br />
       &nbsp;&nbsp;&nbsp;&nbsp;4、您管理着上百台电脑，如网吧、学校机房等
      <br />
       &nbsp;&nbsp;&nbsp;&nbsp;5、您喜欢玩游戏，加入了一些工会
      <br /><br />
      &nbsp;&nbsp;&nbsp;&nbsp;加入购物兔联盟，您只需要把兔子推荐给大家，和大家一起享受购物的乐趣和返现的惊喜，您就能额外获得兔子给您的奖励。
      <br />
      &nbsp;&nbsp;&nbsp;&nbsp;每个月15~20号，将发放上个月的推广费，届时将有短信和邮件通知，短信号码请认准：1065755233080132100。<br />
      &nbsp;
      </div>
  </td></tr>
</table>
<br />
<table width="880" border="0" align="center" cellspacing="0">
<tr><td width="180" style="border:solid; border-width:2px; border-color:#CCCCCC">
<table width="100%" cellspacing="0">
<tr><td height="40" align="center" background="images/g_new_user_bg.png"><img src="images/g_new_user.gif" /></td>
</tr>
<tr><td height="186" valign="top">
<?PHP 
date_default_timezone_set("Asia/Chongqing");
$i = 0;
$result = mysql_query( "select tb_id, type_time from user where type_time <> 'null' order by type_time desc limit 5" );
while( $result && $row = mysql_fetch_assoc( $result ))
{
	$i++;
?>
<div style="height:26px; padding-top:10px;">&nbsp;<img align="absmiddle" src="images/g_new_user_num<?PHP echo $i; ?>.gif" />
<?PHP $tmp=strlen($row["tb_id"]); echo (substr($row["tb_id"], 0, 4)."****".substr($row["tb_id"], $tmp-3, $tmp) ); ?>&nbsp;&nbsp;
<?PHP echo substr($row["type_time"], 0, 10); ?>
</div>
<?PHP } ?>
</td></tr>
</table>
</td>
<td width="1"></td>
<td align="center" background="images/c_link_bg.png" style="border:solid; border-width:2px; border-color:#888888; height:230px;"><img src="images/c_link.jpg" />
    <br /><a href="index_shouyi.html" style="color:#CC3333; font-weight:bold; font-size:14px">详细收益说明</a>&nbsp;</td>
<td width="1"></td>
    <td width="180" style="border:solid; border-width:2px; border-color:#CCCCCC">
<?PHP 
$i = 0;
$m = date('m');
$sql = "select tbid,sum(under_users) as tmp1,sum(fee) as tmp2 from recommend_fee where month(time)=$m group by user_id order by tmp2 desc limit 5";
$result = mysql_query( $sql );
if (mysql_num_rows($result) == 0)
{
	$m -= 1;
	$sql = "select tbid,sum(under_users) as tmp1,sum(fee) as tmp2 from recommend_fee where month(time)=$m group by user_id order by tmp2 desc limit 5";
	$result = mysql_query( $sql );
}
?>    
    <table width="100%" cellspacing="0">
      <tr>
        <td height="40" align="center" background="images/g_new_user_bg.png" style="font-size:14px; font-weight:bold; color:#999999"><span style="font-size:14px; font-weight:bold; color:#FF6600"><?PHP echo ($m - 1);?>月份</span>推广奖励排名</td>
      </tr>
      <tr>
        <td height="186" valign="top">
<?PHP 
while( $result && $row = mysql_fetch_assoc( $result ))
{
	$i++;
?>
            <div style="height:26px; padding-top:10px;">&nbsp;<img align="absmiddle" src="images/g_new_user_num<?PHP echo $i; ?>.gif" />
                <?PHP $tmp=strlen($row["tbid"]); echo (substr($row["tbid"], 0, 4)."****".substr($row["tbid"], $tmp-3, $tmp) ); ?>
              &nbsp;&nbsp; ￥<?PHP echo round($row["tmp2"], 2); ?> </div>
          <?PHP } ?>
        </td>
      </tr>
    </table></td>
    </tr>
</table>
<br />
<table width="880" border="0" align="center" cellspacing="0" bgcolor="#F5F7F7" style="border:solid; border-width:1px; border-color:#999999;">
<tr><td><img src="images/g_jion_us.gif" align="absmiddle" /></td>
</tr>
<tr><td height="86" background="images/g_jion_us_bg.png" style="line-height:1.5;">
<form name="jion" id="jion_id" action="#" method="post" >
<table width="100%">
<?PHP if (isset($_SESSION["code"])) {?>
  <tr>
    <td height="24">&nbsp;&nbsp;&nbsp;&nbsp;<strong>把您的推荐链接发给好友，或者直接告诉他们您的邀请码：</strong><br />
    &nbsp;&nbsp;&nbsp;&nbsp;您的邀请码是： <input type="text" value="<?PHP echo $_SESSION["code"]; ?>" style="border:none; width:80px; background:none" onclick="javascript:select();"/>&nbsp;&nbsp;&nbsp;&nbsp;邀请链接是：<input type="text" value="http://www.gouwutu.com/rmd/<?PHP echo $_SESSION["code"]; ?>.html" style="border:none; width:300px; background:none" onclick="javascript:select();"/></td>
  </tr>

<?PHP } else {?>
<tr><td width="30%" align="right"><img src="images/g_jion_us_text.gif" /></td>
<td width="2%"><img src="images/icon_help.gif" title="就是您绑定到购物兔上的支付宝账号" /></td>
<td width="23%">
<input name="tbid" id="tbid_id" type="text" style="height:28px; width:198px; border:solid; border-width:1px;" /></td>
<td width="14%"><img src="images/g_jion_us_btn.gif" style="cursor:pointer;" onclick="javascript:OnJion();"/></td>
<td><input type="checkbox" id="agree_id" />
  我已阅读并同意“<a href="index_xieyi.html">购物兔用户联盟协议</a>”</td>
</tr>
<?PHP }?>
<tr><td colspan="5" height="8"></td></tr>
<tr>
  <td colspan="5" align="center"><div style="clear:both; overflow:hidden; width:300px;"><p style="font-size:13px; font-weight:bold; color:#CC3333; height:25px; line-height:25px; float:left;">欢迎加入用户联盟专用Q群：</p><p style="height:25px; float:left;"><a target="_blank" href="http://qun.qq.com/#jointhegroup/gid/59518016"><img border="0" src="images/gp.do.png" alt="点击这里加入此群" title="点击这里加入此群"></a></p></div></td>
</tr>
</table>
</form>

  </td></tr>
</table>

<table width="880" border="0" align="center" cellspacing="0">
<tr><td height="10"></td></tr>
<tr><td><hr /></td></tr>
</table>

<table cellpadding="0" cellspacing="0" border="0" width="880" align="center">
<tr>
	<td width="537" height="30" style="padding-left:5px; font-size:12px; color:#666">冰峰科技旗下购物兔 CopyRight 2011 gouwutu.com 粤ICP备11009208号</td>
    <td width="241"><span style="font-size:12px; color:#666">在线QQ客服：<a href="http://wpa.qq.com/msgrd?v=3&amp;uin=1753949757&amp;site=qq&amp;menu=yes" target="_blank"><img align="absmiddle" title="欢迎点击和我们交流" src="http://wpa.qq.com/pa?p=2:1753949757:42" border="0" alt="点击和我们交流" /></a>&nbsp;&nbsp;&nbsp;</span></td>
    <td width="142" height="30" align="right" style="font-size:12px; color:#666"><a href="mailto:admin@gouwutu.com" target="_blank" style="font-size:12px; color:#666; font-weight:400; text-decoration:underline">联系我们</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
</table>
<p />

</body>
</html>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-20984072-1");
pageTracker._trackPageview();
} catch(err) {}</script>

<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F7eb75a7b189f4a709dead85bc20eb0dd' type='text/javascript'%3E%3C/script%3E"));
</script>